String getLineForDigit(int d, int n) {
        String[] patterns = {" _ ", "| |", "|_|", "|_ ", "_|_"};
        int[][] digitPatterns = {{1, 1, 1, 0, 1, 1, 1}, {0, 0, 1, 0, 0, 1, 0}, {1, 0, 1, 1, 1, 0, 1}, {1, 0, 1, 1, 0, 1, 1}, {0, 1, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 0, 1, 1}, {1, 1, 0, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 1, 0}, {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1}};
        if (d < 0 || d > 9) return "";
        int patternIndex = digitPatterns[d][n-1];
        return patternIndex == 1 ? patterns[n-1] : "   ";
}
void display(int n) {
        while (n > 0) {
                int digit = n % 10;
                for (int i = 1; i <= 5; i++) {
                        System.out.print(getLineForDigit(digit, i));
                }
                System.out.println();
                n /= 10;
        }
}
display(28)